package com.lovebugs.xgrid.tags;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lovebugs.AbstractTag;
import com.lovebugs.OgnlContext;
import com.lovebugs.UIBean;
import com.lovebugs.xgrid.components.Column;


public class ColumnTag extends AbstractTag {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private String id;

	private String text;

	private String width = "70";

	private String sortable = "true";

	private String dataIndex;

	private String type;

	private String format;

	private String renderer;

	private String hidden = "false";
	
	private String align = "left";
	
	private String map;
	
	public UIBean getUIBean(OgnlContext ognlContext,HttpServletRequest req,HttpServletResponse resp) {
		return new Column(ognlContext,req,resp);
	}
	
	public void populateParams() { 
		Column column = (Column)this.getComponent();
		column.setAlign(align);
		column.setDataIndex(dataIndex);
		column.setFormat(format);
		column.setHidden(Boolean.parseBoolean(hidden));
		column.setId(id);
		column.setMap(map);
		column.setRenderer(renderer);
		column.setSortable(Boolean.parseBoolean(sortable));
		column.setText(text);
		column.setType(type);
		column.setWidth(width);	
	}

	public String getAlign() {
		return align;
	}

	public void setAlign(String align) {
		this.align = align;
	}

	public String getDataIndex() {
		return dataIndex;
	}

	public void setDataIndex(String dataIndex) {
		this.dataIndex = dataIndex;
	}

	public String getFormat() {
		return format;
	}

	public void setFormat(String format) {
		this.format = format;
	}

	public String getHidden() {
		return hidden;
	}

	public void setHidden(String hidden) {
		this.hidden = hidden;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getMap() {
		return map;
	}

	public void setMap(String map) {
		this.map = map;
	}

	public String getRenderer() {
		return renderer;
	}

	public void setRenderer(String renderer) {
		this.renderer = renderer;
	}

	public String getSortable() {
		return sortable;
	}

	public void setSortable(String sortable) {
		this.sortable = sortable;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getWidth() {
		return width;
	}

	public void setWidth(String width) {
		this.width = width;
	}

}
